﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <!-- 引用通用的js文件. -->
    <script src="../../../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = GetQueryString("RefPK");
            var i = mapExt.RetrieveFromDBSources(); //从数据库来查询.
            if (i == 0) {
                alert("系统错误:没有保存");
                return;
            }

            if (i == 0) {
                mapExt.H = 500;
                mapExt.W = 900;
                mapExt.SetPara("Title", "请选择");

                mapExt.SetPara("SelectType", 0);
                mapExt.Doc = "@WebUser.FK_Dept";
            }

            if (mapExt.W <= 400)
                mapExt.W = 900;


            //绑定数据源类型.
            var ens = new Entities("BP.Sys.SFDBSrcs");
            ens.RetrieveAll();
            GenerBindDDL("DDL_FK_DBSrc", ens, "No", "Name", mapExt.FK_DBSrc);

            //批量为复制.
            GenerFullAllCtrlsVal(mapExt);



        });

        function DBTypeChange() {
            var val = $("#DDL_DBType").val();

            if (val == 0) {
                $("#DBSrc").show();
            } else {
                $("#DBSrc").hide();
            }
        }

        function Save() {

            //更新节点表单类型.
            var frmID = GetQueryString("FK_MapData");
            var keyOfEn = GetQueryString("KeyOfEn");

            var en = new Entity("BP.Sys.MapAttr", frmID + "_" + keyOfEn);
            en.SetPara("PopModel", GetQueryString("PopModel"));
            en.Update();

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = GetQueryString("RefPK");
            mapExt.RetrieveFromDBSources(); //从数据库来查询.

            mapExt.CopyURL();  //从url里面copy数据.
            mapExt.CopyForm(); //从from里面copy数据.

            mapExt.ExtType = GetQueryString("PopModel");
            mapExt.AttrOfOper = GetQueryString("KeyOfEn");

            var err = "";

            if (mapExt.GetPara("TBPara_Title") == "")
                err += '\t\n必填字段[标题]不能为空';

            if (mapExt.Tag1 == "")
                err += '\t\n必填字段[搜索数据源]不能为空';

            if (mapExt.Tag2 == "")
                err += '\t\n必填字段[左侧树列表数据源]不能为空';

            if (mapExt.Tag == "")
                err += '\t\n必填字段[数据列名与中文意思对照]不能为空';

            if (mapExt.DBType == "")
                err += '\t\n必填字段[数据源类型]不能为空';

            var val = mapExt.Save();

            alert("保存成功");
            Reload();
        }
        function Back() {

            var keyOfEn = GetQueryString("KeyOfEn");

            var frmID = GetQueryString("FK_MapData");

            var en = new Entity("BP.Sys.MapAttr", frmID + "_" + keyOfEn);

            var url = GetUrl(GetQueryString("PopModel"));

            document.location.href = url + "?KeyOfEn=" + keyOfEn + "&FK_MapData=" + frmID;
            //    var url = '../Pop/Default.htm?FK_MapData=' + GetQueryString('FK_MapData') + "&KeyOfEn=" + GetQueryString("KeyOfEn");
        }
    </script>
</head>
<body>
    <input id='Btn_Save' type=button onclick='Save()' value='保存' />
    <table class="table" style="width:97%;">
        <tr>
            <td>
                <a href="javascript:ShowHidden('h_title')">标题</a>
                <div id="h_title" style="color: Gray; display: none">
                    <ul>
                        <li>显示在窗口的文字，比如:</li>
                        <li>搜索单据.</li>
                        <li>选择人员.</li>
                        <li>请选择接受人.</li>
                    </ul>
                </div>
            </td>
            <td>
                <input type="text" id="TBPara_Title" name="TBPara_Title" style="width: 99%;" />
            </td>
        </tr>
        <tr>
            <td>打开Pop弹出窗的方式</td>
            <td>
                <input type="radio" id="RBPara_OpenPopType_0" name="RBPara_OpenPopType" value="0" checked/>
                <label for="RBPara_OpenPopType_0">
                    双击打开
                </label>
                <input type="radio" id="RBPara_OpenPopType_1" name="RBPara_OpenPopType" value="1" />
                <label for="RBPara_OpenPopType_1">
                    点击按钮打开
                </label>
            </td>
        </tr>
        <tr>
            <td>按钮标签</td>
            <td>
                <input type="text" id="TBPara_BtnLab" name="TBPara_BtnLab" value="查找"style="width: 99%; text-align: left" />
            </td>
        </tr>
        <tr>
            <td> 弹窗属性 </td>
            <td>
                高度:<input type="text" id="TB_H" name="TB_H" style="width: 80px; text-align: right" />
                宽度:<input type="text" id="TB_W" name="TB_W" style="width: 80px; text-align: right" />
            </td>
        </tr>
        <!--<tr>
            <td>
                <a href="javascript:ShowHidden('HSearch')">搜索提示</a>
                <div id="HSearch" style="color: Gray; display: none">
                    <ul>
                        <li>显示在搜索文本框的背景文字，比如:</li>
                        <li>请输入付款人名称,进行搜索.</li>
                        <li>输入人员编号,名称，名称全拼,简拼关键字搜索.</li>
                    </ul>
                </div>
            </td>
            <td>
                <input type="text" id="TBPara_SearchTip" name="TBPara_SearchTip" style="width: 99%;" />
            </td>
        </tr>-->
        <tr>
            <td>数据源类型</td>
            <td>
                <select id="DDL_DBType" name="DDL_DBType" onchange="DBTypeChange()">
                    <option value="0">执行SQL</option>
                    <option value="1">执行url返回JSON</option>
                    <option value="2">执行CCFromRef.js返回JSON</option>
                </select>
            </td>
        </tr>

        <tr id="DBSrc">
            <td>数据源</td>
            <td>
                <select id="DDL_FK_DBSrc" name="DDL_FK_DBSrc">
                </select>
            </td>
        </tr>

        <tr>
            <td>选择类型</td>
            <td>
                <input type="radio" id="RBPara_SelectType_0" name="RBPara_SelectType" value="0" />
                <label for="RBPara_SelectType_0">
                    单选
                </label>
                <input type="radio" id="RBPara_SelectType_1" name="RBPara_SelectType" value="1" checked/>
                <label for="RBPara_SelectType_1">
                    多选
                </label>
            </td>
        </tr>

        <tr>
            <td colspan="2">
                <label> <input type="checkbox" id="CBPara_IsEnter" /> 是否允许手工输入 </label>
            </td>
        </tr>
    </table>
    <!--<input type='button' value='返回' onclick='Back()' id='Btn_Back' title='' />-->
</body>
</html>
